# coding: utf-8

from datetime import datetime, timedelta
from kombu import Queue, Exchange

from celery.schedules import crontab

# NOTE by chenhj, 以下几行勿删
from common.schedule.config import (
    CELERY_TIMEZONE, BROKER_URL, CELERY_RESULT_BACKEND
)

now = datetime.now()
next_min = now + timedelta(minutes=1)

CELERY_QUEUES = (
    Queue(
        'for_seven_moor_queue',
        Exchange('for_seven_moor_task'),
        routing_key='for_seven_moor_task'
    ),
)

CELERY_ROUTES = {

    'seven_moor_outbound_task': {
        'queue': 'for_seven_moor_queue',
        'routing_key': 'for_seven_moor_task'

    },
    'new_seven_moor_outbound_task': {
        'queue': 'for_seven_moor_queue',
        'routing_key': 'for_seven_moor_task'

    },
    'seven_moor_get_audio_file_task': {
        'queue': 'for_seven_moor_queue',
        'routing_key': 'for_seven_moor_task'
    }

}


CELERYBEAT_SCHEDULE = {

    # 7moor定时任务相关
    'seven_moor_outbound_task': {
        'task': 'seven_moor_outbound_task',
        'schedule': crontab(
            hour=next_min.hour, minute=next_min.minute
        ),
    },
}
